﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ttDuplicateManager
{
    public class itemComparer : IEqualityComparer<fileNameHashPair>
    {
        // Products are equal if their names and product numbers are equal.
        public bool Equals(fileNameHashPair x, fileNameHashPair y)
        {

            //Check whether the compared objects reference the same data.
            if (Object.ReferenceEquals(x, y)) return true;

            //Check whether any of the compared objects is null.
            if (Object.ReferenceEquals(x, null) || Object.ReferenceEquals(y, null))
                return false;

            //Check whether the products' properties are equal.
            return x.md5Hash == y.md5Hash;
        }

        // If Equals() returns true for a pair of objects 
        // then GetHashCode() must return the same value for these objects.

        public int GetHashCode(fileNameHashPair product)
        {
            return product.GetHashCode();
        }

    }

}
